package com.asl.website.companyContact.domain;

/**
 * @author 482944566@qq.com
 * @version 1.0
 * @date 2025-05-22
 */

import com.asl.common.utils.StringUtils;
import com.asl.website.common.Language;

import java.math.BigDecimal;

/**
 * 公司联系信息响应DTO
 */
public class CompanyContactDTO {
    private Long id;
    private String companyName;
    private String address;
    private String phone;
    private String googleMap;
    private String email;
    private String language;

    public CompanyContactDTO(CompanyContact contact, String language) {
        this.id = contact.getId();
        this.phone = contact.getPhone();
        this.googleMap = contact.getGoogleMap();
        this.email = contact.getEmail();
        this.language = language;

        switch (Language.fromCode(language)) {
            case EN_US:
                this.companyName = StringUtils.firstNonBlank(contact.getCompanyNameEn(), contact.getCompanyNameZh());
                this.address = StringUtils.firstNonBlank(contact.getAddressEn(), contact.getAddressZh());
                break;
            case DE_DE:
                this.companyName = StringUtils.firstNonBlank(contact.getCompanyNameDe(), contact.getCompanyNameZh());
                this.address = StringUtils.firstNonBlank(contact.getAddressDe(), contact.getAddressZh());
                break;
            default: // 默认中文
                this.companyName = contact.getCompanyNameZh();
                this.address = contact.getAddressZh();
        }
    }

    // getters
    public Long getId() {
        return id;
    }

    public String getCompanyName() {
        return companyName;
    }

    public String getAddress() {
        return address;
    }

    public String getPhone() {
        return phone;
    }

    public String getGoogleMap() {
        return googleMap;
    }

    public String getEmail() {
        return email;
    }



    public String getLanguage() {
        return language;
    }
}